<!DOCTYPE html>
<!--[if IE 8]> <html lang="zh-CN" class="ie8"> <![endif]-->
<!--[if !IE]><!-->
<html lang="zh-CN">
<!--<![endif]-->
<head>
	<meta charset="utf-8" />
	<title>{SITE_NAME}后台管理系统</title>
	<meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport" />
	<meta content="" name="description" />
	<meta content="" name="author" />
	
	<!-- ================== BEGIN BASE CSS STYLE ================== -->
	<link href="{STATIC_PLUG}/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
	<link href="{STATIC_FONT}/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
	<link href="{STATIC_CSS}/animate.min.css" rel="stylesheet" />
	<link href="{STATIC_CSS}/style.css" rel="stylesheet" />
	<link href="{STATIC_CSS}/style-responsive.min.css" rel="stylesheet" />
	<link href="{STATIC_CSS}/theme/default.css" rel="stylesheet" id="theme" />
	<!-- ================== END BASE CSS STYLE ================== -->

</head>
<body>
	<!-- begin #page-loader -->
	<div id="page-loader" class="fade in"><span class="spinner"></span></div>
	<!-- end #page-loader -->
	
	<div class="login-cover">
	    <div class="login-cover-image"><img src="{STATIC_IMAGE}/login-bg/bg-1.jpg" data-id="login-cover-image" alt="" /></div>
	    <div class="login-cover-bg"></div>
	</div>
	<!-- begin #page-container -->
	<div id="page-container" class="fade">
	    <!-- begin login -->
        <div class="login login-v2" data-pageload-addclass="animated flipInX">
            <!-- begin brand -->
            <div class="login-header">
                <div class="brand">
                    <span class="logo"></span> <span class="{if on_mobile()}f-s-20{else}f-s-22{/if}">{SITE_NAME}后台管理系统</span>
                </div>

            </div>
            <!-- end brand -->
            <div class="login-content">
                <form action="{U('login/check')}" method="POST" class="margin-bottom-0 js_loginForm">
                    <div class="form-group m-b-20">
                        <input type="text" name="admin_name" class="form-control input-lg js_adminName" placeholder="登录账号" autocomplete="off" datatype="*" nullmsg="请填写登录账号！" />
                    </div>
                    <div class="form-group m-b-20">
                        <input type="password" name="password" class="form-control input-lg js_password" placeholder="登录密码" autocomplete="off" datatype="*6-20" nullmsg="请填写登录密码！" errormsg="请填写6-20位密码"/>
                    </div>
                    <div class="checkbox m-b-20">
                        <label>
                            <input type="checkbox" class="js_rememberMe"/> 记住我
                        </label>
                    </div>
                    <div class="login-buttons">
                        <button type="button" class="btn btn-success btn-block btn-lg js_submit" title="支持enter快捷键登录">立即登录</button>
                    </div>

					<div class="m-t-20">
						请输入账号密码进行登录，支持enter键快捷登录
					</div>

                </form>
            </div>
        </div>
        <!-- end login -->
		{if !on_mobile()}
        <ul class="login-bg-list">
            <li class="active"><a href="#" data-click="change-bg"><img src="{STATIC_IMAGE}/login-bg/bg-1.jpg" alt="" /></a></li>
            <li><a href="#" data-click="change-bg"><img src="{STATIC_IMAGE}/login-bg/bg-2.jpg" alt="" /></a></li>
            <li><a href="#" data-click="change-bg"><img src="{STATIC_IMAGE}/login-bg/bg-3.jpg" alt="" /></a></li>
            <li><a href="#" data-click="change-bg"><img src="{STATIC_IMAGE}/login-bg/bg-4.jpg" alt="" /></a></li>

            <li><a href="#" data-click="change-bg"><img src="{STATIC_IMAGE}/login-bg/bg-5.jpg" alt="" /></a></li>
            <li><a href="#" data-click="change-bg"><img src="{STATIC_IMAGE}/login-bg/bg-6.jpg" alt="" /></a></li>
        </ul>
		{/if}
        
        <!-- begin theme-panel -->
        <!-- end theme-panel -->
	</div>
	<!-- end page container -->
	
	<!-- ================== BEGIN BASE JS ================== -->
	<script src="{STATIC_JS}/jquery-1.9.1.min.js"></script>
	<script src="{STATIC_JS}/jquery-migrate-1.1.0.min.js"></script>
	<script src="{STATIC_PLUG}/jquery-ui/js/jquery-ui.min.js"></script>
	<script src="{STATIC_PLUG}/bootstrap/js/bootstrap.min.js"></script>
	<!--[if lt IE 9]>
		<script src="{STATIC_PLUG}/crossbrowserjs/html5shiv.js"></script>
		<script src="{STATIC_PLUG}/crossbrowserjs/respond.min.js"></script>
		<script src="{STATIC_PLUG}/crossbrowserjs/excanvas.min.js"></script>
	<![endif]-->
	<script src="{STATIC_PLUG}/slimscroll/jquery.slimscroll.min.js"></script>
	<script src="{STATIC_PLUG}/jquery-cookie/jquery.cookie.js"></script>
	<!-- ================== END BASE JS ================== -->
	
	<!-- ================== BEGIN PAGE LEVEL JS ================== -->
	<script src="{STATIC_JS}/login.js"></script>
	<script src="{STATIC_JS}/apps.js"></script>
	<!-- ================== END PAGE LEVEL JS ================== -->

	<!--BEGIN 表单验证插件-->
	<script src="{STATIC_PLUG}/validform/v5.3.2_min.js"></script>
	<script src="{STATIC_PLUG}/validform/datatype.js"></script>

	<!--END 表单验证插件-->
	<script>
		$(document).ready(function() {
			//表单验证
			$(".js_loginForm").Validform({

				tiptype:function(msg,o,cssctl){

					//只有表单验证失败时才弹窗
					if(o.type == 3){
						alert(msg);
					}

				},

				label:"label",

				ajaxPost:true,

				btnSubmit:".js_submit",

				beforeSubmit:function(){

					$(".js_submit").attr("disabled", "disabled").text('登录中..');

				},

				callback:function(json){

					if(json.code == 200){
						//记住我
						rememberMe();
						//登录成功，跳转到后台主页
						window.location.href = "{U('index/index')}";

					}else{
						alert(json.msg);
						$(".js_submit").text('重新登录').removeAttr("disabled");


					}

				}

			});

			if($.cookie("rememberMe") == 'true'){
				$(".js_rememberMe").attr('checked', true);
				$(".js_adminName").val($.cookie("adminname"));
				$(".js_password").val($.cookie("password"));
			}

			//jquey.cookie实现记住我功能
			var rememberMe = function(){
				if($('.js_rememberMe').attr('checked')){
					var adminname = $(".js_adminName").val();
					var password = $(".js_password").val();
					$.cookie('rememberMe', 'true', { expires:7 }); //设置cookie有效期为7天
					$.cookie('adminname', adminname, { expires:7 }); //设置cookie有效期为7天
					$.cookie('password', password, { expires:7 }); //设置cookie有效期为7天
				}else{
					$.cookie('rememberMe', 'false', { expires:-1 }); //使cookie失效
					$.cookie('adminname', '', { expires:-1 });//使cookie失效
					$.cookie('password', '', { expires:-1 });//使cookie失效
					$(".js_adminName,.js_password").attr("autocomplete", "off"); //禁止浏览器自动记录
				}
			}

			//UI初始化操作
			App.init();
			Login.init();
		});
	</script>
</body>
</html>
